package com.yl.ylnews.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2016/10/17 0017.
 */

public abstract class BaseFragment extends Fragment {
    public Activity mActivity;//这个activity就是MainActivity

    //fragment创建调用
    @Override
    public void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mActivity = getActivity();
    }

    //初始化布局调用
    @Override
    public View onCreateView(LayoutInflater inflater,  ViewGroup container,  Bundle savedInstanceState) {
        //初始化布局
        return initView();

    }
    //依附的activity初始化完毕调用
    @Override
    public void onActivityCreated( Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        //初始化数据
        initData();

    }
    public abstract void initData();

    public abstract View initView();



}
